/// <summary>
/// Function for finding and killing all running processes
/// initiated by specified user
/// </summary>
/// <param name="user"></param>
/// <returns></returns>
/// <remarks></remarks>
public object KillProcessByUser(ref string user)
{
    try
    {
        //System.Management instances needed
        SelectQuery query = new SelectQuery("Win32_Process");
        ManagementObjectSearcher searcher = new ManagementObjectSearcher(query);
        ManagementOperationObserver observer = new ManagementOperationObserver();

        //loop through each item in the collection
        foreach (ManagementObject process in searcher.Get())
        {
            try
            {
                //this string will hold the information returned
                //from InvokeMethod("GetOwner")
                string[] info = new string[1];

                //get the information on the current process
                process.InvokeMethod("GetOwner", info);

                //now make sure the owner is correct
                if (info[0].ToString().ToUpper() == user)
                {
                    //kill the process
                    process.InvokeMethod(observer, "Terminate", null);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                return false;
            }
        }
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.ToString());
        return false;
    }

    return true;
}